/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: 李白
 * @Created: 2024/4/13 13:19
 */
public class Test {
    public static void main(String[] args) {
        Animal animal = new Dog("圆圆",10);
     //   if (animal instanceof Dog){
            Dog dog = (Dog)animal;
           // Cat cat = (Cat)animal;//
            dog.bark();
           // cat.miao();
      //  }else {
          //  System.out.println("哈哈哈哈");
        }
   // }
}
class Animal{
    public String name;
    public int age;
    public Animal(){

    }

    /**
     * 当我们写了一个构造方法后，Animal方法不再默认给我们提供一个构造方法，需要我们自己创建
     * @param name
     * @param age
     */
    public Animal(String name,int age){
        this.name = name;
        this.age = age;
    }
    public void eat(){
        System.out.println(name+"正在吃饭");
    }
}
class Dog extends Animal{
    public Dog(String name,int age){
        super(name,age);
    }
    public void bark(){
        System.out.println(this.name+"正在嗷嗷叫");
    }
}
class Cat extends Animal{
    public void miao(){
        System.out.println(this.name+"正在咪咪叫");
    }
}